Subroutines

A subroutine is a user-defined command that can be called to perform a block of logic and optionally return a value. Subroutines may have parameters (local variables) which act as variables local to the subroutine and that take on the values of arguments (i.e., numeric expressions) passed to the subroutine.

ProModel handles subroutines in three ways. First, a subroutine may be processed by the calling logic as though the subroutine is part of the calling logic. This way is the most commonly used, and is done by simply referencing the subroutine by name in some logic or expression. Second, a subroutine may be processed independently of the calling logic so the calling logic continues without waiting for the subroutine to finish. This method requires an ACTIVATE statement followed by the name of the subroutine. See Activate, or Run-Time Interact Menu for more information. Third, ProModel allows subroutines written in an external programming language to be called through the XSUB() function.

Subroutines are defined in the Subroutines Editor which is accessed from the Build Menu.

 

How to create and edit subroutines:

1. Select Subroutines from the Build menu.